package org.example.service;

import org.example.controller.UConfig;
import org.example.controller.UserInfo;
import org.example.model.ArticleInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
@Component
public class ArticleService {

    @Bean("aaa") // 将方法返回的对象存储到IoC中
    public ArticleInfo getarticleInfo() {

        // 伪代码  实际项目不会这样子写
        ArticleInfo articleInfo = new ArticleInfo();
        articleInfo.setAid(1);
        articleInfo.setContent("java java");
        articleInfo.setTitle("java");
        articleInfo.setCreateTime(LocalDateTime.now());
        return articleInfo;
    }

//    @Bean("aaa") // 将方法返回的对象存储到IoC中
//    public ArticleInfo getarticleInfo2() {
//
//        // 伪代码  实际项目不会这样子写
//        ArticleInfo articleInfo = new ArticleInfo();
//        articleInfo.setAid(2);
//        articleInfo.setContent("java java");
//        articleInfo.setTitle("java");
//        articleInfo.setCreateTime(LocalDateTime.now());
//        return articleInfo;
//    }
}
